package trastienda.web;

import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import trastienda.modelo.Rol;
import trastienda.service.RolService;

@Controller
public class RolController {
	
	@Autowired
	private RolService rolService;

	public RolService getRolService() {
		return rolService;
	}
	
	 @RequestMapping(value = "/roles_listar", method = RequestMethod.GET)
     protected ModelAndView listar(HttpServletRequest request,
                     HttpServletResponse response) throws Exception {

             Collection<Rol> lista = null;
             lista = rolService.listarTodos();
             return new ModelAndView("categorias_listar", "CATEGORIAS", lista);
     }

}
